import React from 'react';
import Child1 from './Child1';
import Child2 from './Child2';

export default class Parent extends React.Component{
  constructor(){
    super();
    this.state = {
      money: 1
    }
  }
  componentDidMount() {
  }
  onChange = (e) => {
    this.setState({
      money: e.target.value
    })
  }
  render () {
    return(
      <div>
        <p>Parent</p>
        <input type="text" value={ this.state.money } onChange={ this.onChange } />
        <Child1 money={ this.state.money } onChange={ this.onChange } />
        <Child2  money={ this.state.money *7 }  onChange={ this.onChange } />
      </div>
    )
  }
}